Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code health] Create Android Studio template for license headers #2523

Open
anandwana001 opened this issue Jun 27, 2024 · 1 comment
Open
Assignees
Labels
type: code health Improvements to readability or robustness of codebase
Milestone

Comments

@anandwana001
Copy link
Collaborator

anandwana001 commented Jun 27, 2024

Step 1: Create a File Template for the License Header

Open Android Studio.

Go to File > Settings (or Android Studio > Preferences on macOS).

Navigate to Editor > File and Code Templates.

Select Includes from the left-hand side.

Click on the + button to create a new template.

Name your template, for example, License Header.
Add your license text to the template.

/*
 * Copyright ${YEAR} Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Step 3: Share the Configuration with Team via GitHub
Add the following files to your version control system (Git):

.idea/fileTemplates
.idea/fileTemplates/includes
.idea/fileTemplates/code
These directories contain the file and code templates you configured.

git add .idea/fileTemplates
git commit -m "Add license header templates"
git push origin main

@shobhitagarwal1612 @sufyanAbbasi WDYT?

@shobhitagarwal1612
Copy link
Member

I tried the above steps and it didn't auto-insert a license to new kotlin files. @anandwana001 Does it work for you?

@gino-m gino-m added this to the GA release milestone Jul 30, 2024
@gino-m gino-m changed the title [Code health] Automate License Addition to new file [Code health] Create Android Studio template for license headers Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code health Improvements to readability or robustness of codebase
Projects
Status: No status
Development

No branches or pull requests

3 participants