SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
DISTRIBUTED
REFACTORING WITH
GRADLE LINT
Jon Schneider
Netflix Engineering Tools
@jon_k_schneider
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
NETFLIX IS KNOWN FOR
RAPID INNOVATION.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
WE WANT TO MINIMIZE DRAG FROM LATE
ADOPTERS.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
NETFLIX CULTURE IS
FREEDOM AND RESPONSIBILITY
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT
ALLOWS US TO
DISTRIBUTE
CHANGE.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THE UNUSED
DEPENDENCIES
RULE HELPS
MAINTAIN GOOD
DEPENDENCY
HYGIENE.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT SUPPORTS
SHIPPING METRICS TO
nebula.metrics
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
CREATING A MORE COMPLEX RULE
"All wars should be published to our
binary repository"
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
1: APPLY IMMEDIATELY AFTER THE WAR
PLUGIN
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') {
addBuildLintViolation('WARs must be published', call)
.insertAfter(call, "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
2: APPLY ONLY IF IT ISN'T ALREADY
APPLIED
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') bookmark('applyWar', call)
else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(bookmark('applyWar') && !bookmark('applyWarPublish')) {
addBuildLintViolation('WARs must be published', call)
.insertAfter(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
3: REPLACE THE WAR PLUGIN ENTIRELY
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') bookmark('applyWar', call)
else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(bookmark('applyWar') && !bookmark('applyWarPublish')) {
addBuildLintViolation('WARs must be published', call)
.replaceWith(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
4: BECOME GRADLE MODEL AWARE
class AllWarsShouldBePublishedRule extends GradleLintRule implements GradleModelAware {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
bookmark('lastApplyPlugin', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(project.plugins.hasPlugin(WarPlugin) &&
!project.plugins.hasPlugin('netflix.war-publish')) {
addBuildLintViolation('WARs must be published', call)
.insertAfter(
bookmark('lastApplyPlugin'),
"apply plugin: 'netflix.war-publish'"
)
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT IS OUR FIRST
DISTRIBUTED REFACTORING
TOOL.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THE EXPERIMENTAL LOCK PLUGIN IS
ANOTHER EXAMPLE.
github.com/nebula-plugins/lock-
experimental
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
WE WANT AN
EVENTUALLY CONSISTENT
MONOREPO
THROUGH
DISTRIBUTED REFACTORING.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
JAVA POWER ASSERT WAS THE
LEARNING GROUND.
github.com/jkschneider/java-power-assert
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THANK YOU.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT

Weitere ähnliche Inhalte

Ähnlich wie Distributed Refactoring with Gradle Lint

Open Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core SummitOpen Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core SummitIdo Green
 
Thinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and XamarinThinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and XamarinRod Hemphill
 
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit ApplicationsUS-Ignite
 
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...Gaël Blondelle
 
Green house software
Green house softwareGreen house software
Green house softwareVinod Pol
 
Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?José Luis Núñez Díaz
 
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim KadlecDevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim KadlecDevSecCon
 
Ceph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community UpdateCeph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community UpdateCeph Community
 
Ceph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community UpdateCeph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community UpdateDanielle Womboldt
 
Hyperledger Fabric in a Nutshell
Hyperledger Fabric in a NutshellHyperledger Fabric in a Nutshell
Hyperledger Fabric in a NutshellDaniel Chan
 
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016Renato Cruz
 
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con ConfluentIoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con Confluentmimacom
 
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16Chad Curry
 
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !Priyanka Aash
 

Ähnlich wie Distributed Refactoring with Gradle Lint (20)

Open Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core SummitOpen Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core Summit
 
Thinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and XamarinThinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and Xamarin
 
L19 Local
L19 LocalL19 Local
L19 Local
 
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit Applications
 
L20 Personalised World
L20 Personalised WorldL20 Personalised World
L20 Personalised World
 
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
 
Green house software
Green house softwareGreen house software
Green house software
 
Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?
 
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim KadlecDevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
 
L Migrator Pres
L Migrator PresL Migrator Pres
L Migrator Pres
 
Ceph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community UpdateCeph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community Update
 
Ceph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community UpdateCeph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community Update
 
Hyperledger Fabric in a Nutshell
Hyperledger Fabric in a NutshellHyperledger Fabric in a Nutshell
Hyperledger Fabric in a Nutshell
 
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
 
BigchainDB and Beyond
BigchainDB and BeyondBigchainDB and Beyond
BigchainDB and Beyond
 
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con ConfluentIoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
 
Observability
ObservabilityObservability
Observability
 
Observability
ObservabilityObservability
Observability
 
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
 
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
 

Kürzlich hochgeladen

FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 

Kürzlich hochgeladen (20)

FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 

Distributed Refactoring with Gradle Lint

  • 1. DISTRIBUTED REFACTORING WITH GRADLE LINT Jon Schneider Netflix Engineering Tools @jon_k_schneider GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 3. NETFLIX IS KNOWN FOR RAPID INNOVATION. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 4. WE WANT TO MINIMIZE DRAG FROM LATE ADOPTERS. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 5. NETFLIX CULTURE IS FREEDOM AND RESPONSIBILITY GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 6. GRADLE LINT ALLOWS US TO DISTRIBUTE CHANGE. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 7. THE UNUSED DEPENDENCIES RULE HELPS MAINTAIN GOOD DEPENDENCY HYGIENE. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 8. GRADLE LINT SUPPORTS SHIPPING METRICS TO nebula.metrics GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 9. CREATING A MORE COMPLEX RULE "All wars should be published to our binary repository" GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 10. 1: APPLY IMMEDIATELY AFTER THE WAR PLUGIN class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') { addBuildLintViolation('WARs must be published', call) .insertAfter(call, "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 11. 2: APPLY ONLY IF IT ISN'T ALREADY APPLIED class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') bookmark('applyWar', call) else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call) } @Override protected void visitClassComplete(ClassNode node) { if(bookmark('applyWar') && !bookmark('applyWarPublish')) { addBuildLintViolation('WARs must be published', call) .insertAfter(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 12. 3: REPLACE THE WAR PLUGIN ENTIRELY class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') bookmark('applyWar', call) else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call) } @Override protected void visitClassComplete(ClassNode node) { if(bookmark('applyWar') && !bookmark('applyWarPublish')) { addBuildLintViolation('WARs must be published', call) .replaceWith(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 13. 4: BECOME GRADLE MODEL AWARE class AllWarsShouldBePublishedRule extends GradleLintRule implements GradleModelAware { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { bookmark('lastApplyPlugin', call) } @Override protected void visitClassComplete(ClassNode node) { if(project.plugins.hasPlugin(WarPlugin) && !project.plugins.hasPlugin('netflix.war-publish')) { addBuildLintViolation('WARs must be published', call) .insertAfter( bookmark('lastApplyPlugin'), "apply plugin: 'netflix.war-publish'" ) } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 14. GRADLE LINT IS OUR FIRST DISTRIBUTED REFACTORING TOOL. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 15. THE EXPERIMENTAL LOCK PLUGIN IS ANOTHER EXAMPLE. github.com/nebula-plugins/lock- experimental GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 16. WE WANT AN EVENTUALLY CONSISTENT MONOREPO THROUGH DISTRIBUTED REFACTORING. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 17. JAVA POWER ASSERT WAS THE LEARNING GROUND. github.com/jkschneider/java-power-assert GITHUB.COM/NETFLIXGRADLESUMMIT/LINT