NexGen Project Template Generation Tool
⚓ Template Project Generation
-
Create a new folder for the
Android Library Project
, that is being setup. -
Clone the toolset repository inside the newly created folder.
git clone ssh://git@domain:port/repo_path.git ./toolset
-
Get into the
toolset
folder and execute the./createProjTemplate.sh
script to setup the basic template project- The script takes the following mandatory parameters
Group Name
(should be a valid JAVA Package identifier)Library/Artifact Name
(should be a valid alphanumeric value that can optionally be hyphenated)
./createProjTemplate.sh -g com.example.sample -l foundation
Once the above steps are successfull, a new project with a template folder structure will be created and
toolset
will be added as submodule of the base project. - The script takes the following mandatory parameters
-
Open the
Jenkinsfile.groovy
pipeline file and update the appropriate git remote for the created repository.checkout([ //.... url : 'ssh://git@domain:port/repo_path.git' //... ]
-
Stage all the files, commit and push it to the above mentioned remote.
-
Create a Multi-Branch Jenkins Pipeline and configure the above mentioned repository
The repository is now ready with all bikeshedding work
configured.
⚓ A typical top-level directory layout
.
├── lib # An `android-library` sub-project containing actual implementation.
├── sample # An `android-application` to instrument/verify library functionalities.
├── toolset # Contains common dependencies and tools used across projects.
├── build.gradle # Root Project's `build.gradle` that applies tools from `toolset`.
├── settings.gradle # Includes `lib` and `sample` sub-projects for compilation.
├── gradle.properties # Contains default properties for the project.
├── Jenkinsfile.groovy # Configures Jenkins Pipeline
└── README.md # Created to update context about Project
lib
sub-project
📁 All the actual implementation of the Library goes inside this folder.
This will generate an Android Archive which can be published to any maven repository
<LibraryName>
LibraryInfo.kt
⚙ Maintains the library versioning.
/**
* The Major version of the library
*/
@SuppressWarnings("unused")
const val MAJOR_VERSION: Int = 1
/**
* The Minor version of the library
*/
@SuppressWarnings("unused")
const val MINOR_VERSION: Int = 1
/**
* The Path version of the library
*/
@SuppressWarnings("unused")
const val PATCH_VERSION: Int = 0
On every push
to master
- a build is triggerred,
- current version is tagged
- and the PATCH_VERSION is upgraded in this file
MAJOR_VERSION and MINOR_VERSION has to be manually upgraded when necessary.
⚙ library.properties
A property file
that has the following details on the library
groupID
- The Group ID under which the artifact needs to be publishedartifactID
- The name of the artifact filelibraryInfoPath
- Therelative path
to the LibraryInfo class file from the library folder.
⚙ publish.properties
A property file
that contains the details about the maven repositories to which the artifact should be published
repositoryNames
- List of Maven Repository Names seperated by semi-colon (;)snapshotURLs
- List of Snapshot URLs with positions corresponding to the repositoryNames specified abovereleaseURLs
- List of Release URLs with positions corresponding to the repositoryNames specified abovecredentials
- List of Credentials for Maven Repository with positions corresponding to the repositoryNames specified above. If no crendentials are needed, a place holder (null;) MUST be used.
toolset
submodule(🔗)
📁 This MUST be a submodule
of the created library project and should be one of the top-level directories of the project.
It contains the following:
classpath of all the gradle plugins
used commonly across projects.configuration for all the bike-shedding tools
(🛠) used.
🛫 Jenkinsfile.groovy
This file is configured for compiling and publishing the artifacts to maven.
Currently this is configured to EG Nexus and Maven Repositories.
This can be changed if we need to migrate to a different environment.
🚧🏗
🚧 Technical Debts
- Generate
lib-sources
artifact and publish to Maven. - Stream Edit Jenkins Pipeline by taking
remote-url
as input. - Generate
lib-documentation
artifact and publish to Maven.