在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Netflix/gradle-template开源软件地址(OpenSource Url):https://github.com/Netflix/gradle-template开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):This project represents a template for what a Netflix OSS project should look like. We're striving for a pure Gradle build, instead of taking a consolidated plugin approach, as we would internally. This will maintain each project's isolation and keep the build as transparent as possible to the outside world. While at the same time we want to be able to push out build updates in a predictable fashion. There are three branches for which you should concern yourself with:
Choosing a branchThe goal is that projects will be able to "git merge build/branch" when changes are needed to be pushed out. If you take the wrong branch and consequently heavily modify the files, the merge will be a pain. The other advantage of using an appropriate branch is to provide a level of consistency between the projects. The master branch is best for new projects who want something working out of the gate, but after that you'd migrate to merging from the multi-project so that you don't get bad merges from the same java files. The multi-project branch is for projects which have multiple modules that will be published together, e.g. client, common and server modules. Gradle is very good at building multiple projects, but it does require slightly different syntax and isolation from the rootProject, hence the separate project. The single-project branch is the simplest build which is for a single project. All project use a Maven layout, e.g. src/main/java. FeaturesThe template features:
Merging build filesMerging in the build should be a four step process: merge, customize, test and delete pom.xml. In general, this is only done once and while we work out the kinks, Engineering Tools is willing to do the initial port to Gradle and provide a pull request, just contact [email protected] MergingThis will pull in the template:
Customize
If in a multi-module project, edit the build.gradle and create a project block for each project, there are two by default which you override. The dependencies will have to be changed to match the pom dependencies. In the single-project branch, simply follow the dependencies block. In the multi-project branch, there are a few dependencies sections. The first one, part of subprojects, is common to all projects. And then there's a dependency block for each project. Delete the pom.xml
Updating TemplateAs updates are put into the gradle-template project, individual OSS Projects will need to merge in those changes. Any changes will be announced to the DL Open Source Software. To perform that merge run this, using the branch you choose when you first setup the project:
ArtifactoryBy itself the above build.gradle will pull from Maven Central and publish to Maven Central, to use Netflix infrastructure we provide an "init script" to orchestrate Gradle to use artifacts.netflix.com. This pulls in artifactory.gradle, which is sourced from //depot/Tools/nebula-boot/artifactory.gradle. It's job is to:
Two targets available to use artifactoryi:
PropertiesGradle has a few ways to inject properties into the project, which can then be used in the DSL. It can done on the command line via the "-P option, e.g. ./gradlew -Pmyproperty=myvalue". It can also be done via Java System Property as long as it's prefixed with ORG_GRADLE_PROJECT, e.g. ./gradlew -DORG_GRADLE_PROJECT_myproperty=myvalue. To avoid having to pass in some properties every time on the command line, they can be stored in $HOME/.gradle/gradle.properties. When publishing to Maven Central, we need a few "secrets" to sign the artifacts and to log into Sonatype. Most of these are handled by the [OSS Jenkins] page. If you had to release from your desktop, the best way to store these is to create this file in your home directory, with the appropriate values:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论